//
//  Login_BtConnectTableViewCell.m
//  TY-C
//
//  Created by xyyl on 2024/2/29.
//

#import "Login_BtConnectTableViewCell.h"

@implementation Login_BtConnectTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if(self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self initViews];
        [self initFrames];
    }
    return self;
}

- (void)initFrames {

    CGFloat xscale = [@"" oppositeX:45 ToBigX:320];
    CGFloat yscale = [@"" oppositeY:27 ToBigY:240];
    
    [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset((45 * IPADSCALE));
        make.height.equalTo(@(27 * IPADSCALE));
        make.right.equalTo(self.contentView.mas_right).offset(-45 * IPADSCALE);
        make.top.equalTo(self.contentView).offset(10 * IPADSCALE);
    }];
    
    _backView.backgroundColor = RGBColor(241, 249, 253);
    
    
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.height.equalTo(_backView);
        make.left.equalTo(_backView).offset(20);
        make.width.equalTo(@300);
    }];
    _titleLab.numberOfLines = 0;
    _titleLab.font = ZYQFONT(16);
    _titleLab.text = @"TY  Bluetooth 01";
    _titleLab.textColor = RGBColor(102, 102, 102);
    
    [_connectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(_backView);
        make.width.equalTo(@(43 * IPADSCALE));
        make.right.equalTo(_backView.mas_right).offset(-22.5);
        make.height.equalTo(@(18*IPADSCALE));
    }];
    [_connectBtn setBackgroundImage:[UIImage imageNamed:@"bl_lj2"] forState:0];
    [_connectBtn setBackgroundImage:[UIImage imageNamed:@"bl_lj"] forState:UIControlStateSelected];
    _connectBtn.selected = YES;

}
- (void)initViews {
    _backView = [UIView new];
    [self.contentView addSubview:_backView];
    _backView.userInteractionEnabled = YES;
    
    _titleLab = [UILabel new];
    [_backView addSubview:_titleLab];
    
    _connectBtn = [UIButton new];
    [_backView addSubview:_connectBtn];
    
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
